package com.baliejun.springsell.converter;


import com.baliejun.springsell.bean.OrderMaster;
import com.baliejun.springsell.dto.OrderMasterDTO;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @Author: LiejunBa
 * @Description:
 * @Date: 2020/12/10 2:16 下午
 */
public class OrderMasterToOrderMasterDTOConverter {

    public static OrderMasterDTO convert(OrderMaster orderMaster){
        OrderMasterDTO orderMasterDTO = new OrderMasterDTO();
        BeanUtils.copyProperties(orderMaster, orderMasterDTO);
        return orderMasterDTO;
    }

    public static List<OrderMasterDTO> convert(List<OrderMaster> orderMasterList){

        List<OrderMasterDTO> orderMasterDTOList = orderMasterList.stream().map(e -> convert(e)).collect(Collectors.toList());

        return orderMasterDTOList;


    }

}
